#pragma once

#include <string>
#include <set>
#include <functional>
#include "Singleton.h"
#include "MsgRouter.h"
#include "gameinfo.h"


class GameInfoService
{
public:
    bool Init();

public:
    GameInfoService() = default;
    virtual ~GameInfoService() = default;

public:
    static GameInfoService* Instance()
	{
		return CSingleton<GameInfoService>::Instance();
	}

public:
    enum Sence
    {
        ACCESS_LOGIN = 100,
    };
public:
    bool HandleGameInfo(const std::uint32_t agency_id, const std::uint32_t game, std::string&& trans, Sence sence);
    void OnGameinfo(MsgData&& data);
    inline void ListenOnGameinfo(Sence sence, std::function<void(stGameInfo* gameinfo, std::int32_t err_code, std::string&& trans)> listen)
    {
        m_gameinfo_listen[sence] = listen;
    }
private:
    std::map<Sence, std::function<void(stGameInfo* gameinfo, std::int32_t err_code, std::string&& trans)>> m_gameinfo_listen;


};










